package util;

import java.util.Map;

/**
 * @classname:ResponsResult
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/22 21:32
 * @version: 0.1
 * @since:1.8
 */
public class ServerResponseResult<T> {
    private String message;
    private Integer status;
    private Map data;

    private ServerResponseResult(){}

    private ServerResponseResult(String message, Integer status, Map data) {
        this.message = message;
        this.status = status;
        this.data = data;
    }

    private ServerResponseResult(String message, Integer status) {
        this.message = message;
        this.status = status;
    }

    //成功
         static  ServerResponseResult success( Map data){
        return new ServerResponseResult(CodeEnum.SUCCESS.getMsg(),CodeEnum.SUCCESS.getCode(),data);
    }
    //失败
        static  ServerResponseResult fail(){
        return new ServerResponseResult(CodeEnum.ERRO.getMsg(),CodeEnum.ERRO.getCode());
        }

    String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Map getData() {
        return data;
    }

    public void setData(Map data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ServerResponseResult{" +
                "message='" + message + '\'' +
                ", status=" + status +
                ", data=" + data +
                '}';
    }
}
